package com.salt.common;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Response code
 *
 * @author HaiBo Kuang
 * @version 0.0.1 2021/3/30
 * @since 0.0.1
 */
public enum ResponseStatus {
    // Success
    OK(0, "Success"),
    // server error
    INTERNAL_SERVER_ERROR(500, "Server error"),
    USERNAME_PASSWORD_INCORRECT(1000, "用户名或密码错误"),
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_ALREADY_EXISTS(1002, "用户名或手机号已存在"),
    USER_ALREADY_AUTHENTICATED(2000, "用户已实名认证"),
    USER_NOT_AUTHENTICATED(2001, "用户未实名认证"),
    ORDER_NOT_FOUND(3000, "订单不存在"),
    ORDER_NOT_BELONG_USER(3001, "订单不属于用户"),
    ORDER_UNPAID(3002, "订单未支付"),
    ORDER_CANCELLED_CANNOT_OPERATED(3003, "订单已取消无法操作"),
    ORDER_PICKED_CAR_CANNOT_CANCEL(3004, "订单已接车，无法直接取消"),
    ORDER_NOT_PICK_CAR_CANNOT_END(3005, "订单未接车，无法直接终止"),
    ORDER_INSURE_FAIL_CANNOT_PICK_CAR(3006, "订单未投保成功，不能操作接车"),
    ORDER_NOT_PICK_CAR_CANNOT_RETURN(3007, "订单还未接车，不能操作还车"),
    WE_CHAT_NO_BIND(4000, "微信未绑定"),
    WE_CHAT_SECRET_FREE_LOGIN_FAIL(4001, "微信免密登陆失败");

    private final int value;
    private final String description;

    ResponseStatus(int i, String description) {
        this.value = i;
        this.description = description;
    }

    public int getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    @JsonValue
    public Integer getJsonValue() {
        return value;
    }
}
